//
//  DiaryBannerCell.m
//  PaiLeXiongProject
//
//  Created by 小獾科技 on 2017/8/23.
//  Copyright © 2017年 小獾科技. All rights reserved.
//

#import "DiaryBannerCell.h"

@interface DiaryBannerCell ()

@end

@implementation DiaryBannerCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
//        _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, GWIDTH, 300)];
//        _scrollView.contentSize = CGSizeMake((GWIDTH - 100) * 3, 300);
//        [self addSubview:_scrollView];
//        
//        for(int i = 0; i < 3; i++)
//        {
//            _imgView = [[UIImageView alloc] initWithFrame:CGRectMake( (_scrollView.frame.size.width - 100) * i + 5 , 0, CGRectGetWidth(_scrollView.bounds) - 100 - 10, 200)];
//            _imgView.backgroundColor =[UIColor colorWithRed:arc4random() % 256 / 255.0  green:arc4random() % 256 / 255.0  blue:arc4random() % 256 / 255.0  alpha:1];
//            _imgView.tag = 100 + i;
//            [_scrollView addSubview:_imgView];
//            _titleLabel =[[UILabel alloc] initWithFrame:CGRectMake( (_scrollView.frame.size.width - 100) * i, 200 + 15, CGRectGetWidth(_scrollView.bounds) - 100, 25)];
//            _titleLabel.text = @"  妈咪：2-6个月的婴儿游泳备记";
//            _titleLabel.textColor = ColorFrom16(0x202020);
//            _titleLabel.font = PFMFONT(18);
//            _titleLabel.textAlignment = 1;
//            _titleLabel.adjustsFontSizeToFitWidth = YES;
//            _titleLabel.tag = 200 + i;
//            _titleLabel.centerX = _imgView.centerX;
//            [_scrollView addSubview:_titleLabel];
//            
//            UIView *view = [[UIView alloc] initWithFrame:CGRectMake( (_scrollView.frame.size.width - 100) * i, 200 + 15 + 25 + 12, CGRectGetWidth(_scrollView.bounds) - 100, 17)];
//            [_scrollView addSubview:view];
//            
//            _aImage = [[UIImageView alloc] initWithFrame:CGRectMake(76, 0, 65, 17)];
//            _aImage.image = IMAGE(@"diary_new.jpg");
//            _aImage.backgroundColor = ColorBlack;
//            [view addSubview:_aImage];
//            
//            _commendLabel = [[UILabel alloc] initWithFrame:CGRectMake(76 + 65 + 5 , 0, 68, 17)];
//            _commendLabel.text = @"853条点评";
//            _commendLabel.tag = 300 + i;
//            _commendLabel.textColor = ColorFrom16(0x323232);
//            _commendLabel.font = PFRFONT(12);
////            _commendLabel.textAlignment = 1;
//            [view addSubview:_commendLabel];
//            
//            
//        }
//        _scrollView.contentOffset = CGPointMake((GWIDTH - 150) , 0);//CGRectGetWidth(scrollView.bounds) * 2 是设置默认为第几个视图
//        _scrollView.showsHorizontalScrollIndicator = NO;
    }
    return self;
}



- (UIScrollView *)scrollView
{
    if(!_scrollView)
    {
        _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, GWIDTH - 1, 300)];
        _scrollView.contentSize = CGSizeMake((GWIDTH - 100) * 3, 300);
        _scrollView.contentOffset = CGPointMake((GWIDTH - 150) , 0);//CGRectGetWidth(scrollView.bounds) * 2 是设置默认为第几个视图
        _scrollView.showsHorizontalScrollIndicator = NO;

    }
    return _scrollView;
}

//- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
//{
//    return _scrollView;
//}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
